<template>
  <ele-modal
    :width="950"
    :visible="visible"
    :confirm-loading="loading"
    :title="'详情'"
    :body-style="{ paddingBottom: '30px' }"
    @update:visible="updateVisible"
    :footer="null"
  >
    <a-form
      :label-col="{ md: { span: 7 }, sm: { span: 4 }, xs: { span: 24 } }"
      :wrapper-col="{ md: { span: 17 }, sm: { span: 20 }, xs: { span: 24 } }"
    >
      <a-row :gutter="24">
        <a-col :md="23" :sm="23" :xs="23">
          <table cellpadding="0" cellspacing="0" class="recepit_table2">
            <tbody>
              <tr>
                <td>点数方式</td>
                <td class="tit">{{ detail.type_name || '' }}</td>
              </tr>
              <tr>
                <td>点数位置</td>
                <td class="tit">{{ detail.type_code_name || '' }}</td>
              </tr>
              <tr>
                <td>负责人</td>
                <td class="tit">{{ detail.charge_user_name || '' }}</td>
              </tr>
              <tr>
                <td>提交时间</td>
                <td class="tit">{{ detail.create_time || '' }}</td>
              </tr>
              <tr>
                <td>备注</td>
                <td class="tit">{{ detail.note || '' }}</td>
              </tr>
            </tbody>
          </table>
          <div class="fs-16 margin-y-30">货品点数</div>
          <vxe-table align="center" :data="tableData">
            <vxe-column field="type_name" title="大类+小类" />
            <vxe-column field="num" title="账面库存" />
            <vxe-column field="checked" title="点数" />
          </vxe-table>
        </a-col>
      </a-row>
    </a-form>
  </ele-modal>
</template>

<script setup>
  import { ref, reactive, onMounted } from 'vue';
  import { Form, message } from 'ant-design-vue';
  import { emailReg, phoneReg, identityReg } from 'ele-admin-pro';
  import { get_detail } from '@/api/warehouse/tenant_check';

  const props = defineProps({
    // 弹窗是否打开
    visible: Boolean,
    detailId: [String, Number]
  });

  const emit = defineEmits(['done2', 'update:visible']);

  // 提交状态
  const loading = ref(false);
  const detail = ref({});
  const tableData = ref([]);

  onMounted(() => {
    get_detail({ check_id: props.detailId })
      .then((res) => {
        detail.value = res.detail ? res.detail : {};
        tableData.value = res.item;
      })
      .catch((e) => {
        message.error(e);
      });
  });

  /* 更新visible */
  const updateVisible = (value) => {
    emit('update:visible', value);
  };
</script>
<style scoped></style>
